package com.cuc.authserver.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.security.Principal;

/**
 */
@RestController
public class UserController {
    @GetMapping("/user")
    public Principal getCurrentUser(Principal principal) {
        return principal;
    }

    @RequestMapping("")
    public void login(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        resp.sendRedirect("http://127.0.0.1:1112/hello");
    }

}
